package model

import (
	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	UserName    string `gorm:"varchar(20);not null" json:"userName"`
	PhoneNumber string `gorm:"varchar(20);not null;unique" json:"phoneNumber"`
	Password    string `gorm:"size:255;not null" json:"password"`
	Avatar      string `gorm:"size:255;not null" json:"avatar"`
}

type UserInfo struct {
	ID       uint   `json:"id"`
	Avatar   string `json:"avatar"`
	UserName string `json:"user_name"`
}

type UserRegisterRequest struct {
	UserName    string `json:"userName" binding:"required"`
	PhoneNumber string `json:"phoneNumber" binding:"required"`
	Password    string `json:"password" binding:"required"`
}

type UserLoginRequest struct {
	PhoneNumber string `json:"phoneNumber" binding:"required"`
	Password    string `json:"password" binding:"required"`
}

type UserUpdatePasswordRequest struct {
	Id          uint   `json:"id" binding:"required"`
	NewPassword string `json:"new_password" binding:"required"`
}

type UserUpdateAvatarRequest struct {
	NewAvatar string `json:"avatar" binding:"required"`
}

type UserUpdateNameRequest struct {
	NewName string `json:"userName" binding:"required"`
}

type UserNameRequest struct {
	PhoneNumber string `json:"phone_number" binding:"required"`
}
